<script setup name="SvgIcon">
import { computed } from "vue";

const props = defineProps({
  prefix: {
    type: String,
    default: "icon",
  },
  name: {
    type: String,
    required: true,
  },
  class: {
    type: String,
    default: "",
  },
  color: {
    type: String,
    default: "#828282",
  },
});

const symbolId = computed(() => `#${props.prefix}-${props.name}`);
const _class = props.class.split(" ");
</script>

<template>
  <svg
    :class="['svg-icon', 'flex', 'justify-center', 'align-center', ..._class]"
    aria-hidden="true"
  >
    <use :href="symbolId" :fill="color" />
  </svg>
</template>

<style lang="scss" scoped>
.svg-icon {
  width: 20px;
  height: 20px;
  color: #828282;
  fill: currentColor;
  overflow: hidden;
}
</style>
